#include "Transfer.h"
#include "State.h"
#include <QDebug>


void Transfer::AddAction(ActionPtr action)
{
    _actions.append(action);
}

void Transfer::SetDestination(StatePtr state)
{
    _destination = state;
}

void Transfer::PerformActions()
{
    Q_FOREACH(ActionPtr action, _actions)
        action->Perform();
}

void Transfer::LeaveState()
{
    emit NextState(_destination); 
}

void Transfer::Perform()
{   
    PerformActions();
    LeaveState();
}